<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml" xmlns:cms="http://thymeleafexamples">
<head th:include="include/head">

</head>
<style>
    .content-wrapper, .main-footer, .main-header{
        margin-left: 0;
    }
</style>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="wrapper">


    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <div class="container-fluid">
                <div class="row mb-2">
                    <div class="col-sm-6">
                        <h1>待面试列表</h1>
                    </div>
                    <div class="col-sm-6">
                        <ol class="breadcrumb float-sm-right">
                            <li class="breadcrumb-item"><a href="#">首页</a></li>
                            <li class="breadcrumb-item active">待面试列表</li>
                        </ol>
                    </div>
                </div>
            </div>
            <!-- /.container-fluid -->
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-header">
                                <h3 class="card-title">待面试列表</h3>
                                <!--                                	   <button type="button" class="btn btn-primary btn-sm" id="add" style="float: right">新增</button>-->
                            </div>
                            <div class="card-header">
                                <form id="search-form2" class="navbar-form form-inline"  th:action="@{/candidate/stay_interview}" method="post">
                                    <div class="form-group " >
                                        <label>归属部门:</label>
                                        <div class="col-sm-2" >
                                            <!--												0新增；1处理中；2挂起；3已完成-->
                                            <select  class="form-control"   id="baseId" name="baseId" >
                                                <option value="">全部</option>
                                                <option  th:each="model : ${baseList}" th:value="${model.baseId}"
                                                         th:text="${model.baseName}" th:selected="${model.baseId}==${baseId}" value="0">否</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group ">
                                        <label >项目</label>
                                        <div class="col-sm-2">
                                            <select  class="form-control"   id="projectId" name="projectId"  >
                                                <option value="0">全部门</option>
                                                <option  th:each="model : ${projectList}" th:value="${model.projectId}"
                                                         th:text="${model.projectName}" th:selected="${model.projectId}==${projectId}" value="0">否</option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="form-group " >
                                        <label>候选者姓名:</label>
                                        <div class="col-sm-4" >
                                            <input type="text" name="examinerName" th:value="${examinerName}" placeholder="候选者姓名" class="form-control">
                                        </div>
                                    </div>
                                    <div class="form-group " >
                                        <button type="button" id="serch"  style="font-size:0.5rem;" class="btn btn-primary pull-right">查询</button>
                                    </div>
                                </form>

                            </div>
                            <!-- /.card-header -->
                            <div class="card-body">
                                <table class="table table-bordered">
                                    <thead>
                                    <tr>
                                        <!-- 												<th style="width: 10px">#</th> -->
                                        <th>候选者</th>
                                        												<th>面试时间</th>
                                        <th>部门</th>
                                        <th>项目</th>
                                        <!--												<th style="width: 250px">操作</th>-->
                                    </tr>
                                    </thead>
                                    <tbody id="content">
                                    <tr th:each="bean : ${pageInfo.list}" th:attr="id=tr_+${bean.cid}">
                                        <td th:text="${bean.cname}"></td>
                                        <td th:text="${bean.itime}"></td>
                                        <td th:text="${bean.bname}"></td>
                                        <td th:text="${bean.pname}"></td>
                                        <!--												<td th:text="${bean.examinerState==0?'禁用':'启用'}"></td>-->
                                        <!-- 												<td> -->
                                        <!-- 													<button type="button" class="btn btn-primary btn-sm sortUp" -->
                                        <!-- 														th:attr="library-id=|${bean.userId}">上移</button> -->
                                        <!-- 													<button type="button" class="btn btn-info btn-sm sortDown" -->
                                        <!-- 														th:attr="library-id=|${bean.userId}">下移</button> -->
                                        <!-- 												</td> -->
                                        <!--												<td>-->
                                        <!--													<a th:href="'qlist?id='+${bean.cid}" class="btn btn-info btn-sm">-->
                                        <!--														<i class="fas fa-pencil-alt"></i>查看-->
                                        <!--													</a>-->
                                        <!--													<a th:href="'add?id='+${bean.cid}" class="btn btn-info btn-sm">-->
                                        <!--													 	<i class="fas fa-pencil-alt"></i>编辑-->
                                        <!--													</a>-->
                                        <!--													<a href="javascript:;" th:attr="data-id=|${bean.cid}" class="btn btn-danger btn-sm del">-->
                                        <!--														<i class="fas fa-trash"></i>删除-->
                                        <!--													</a>-->
                                        <!--												</td>-->
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <cms:page></cms:page>
                        </div>

                    </div>
                </div>
            </div>
        </section>
    </div>
</div>
<!-- ./wrapper -->
<div th:include="include/foot"></div>
<script>
    $("#baseId").change(function (){
        let v=$(this).val();
        let t= $(this).find("option:selected").text();
        console.log(v,t)
        if(v>0){
            $("#baseName").val(t);
            $.ajax({url:'../library/projectList',data:"baseId="+v,success:function (data){
                    console.log(data)
                    if(data.res){
                        $("#projectId").empty();
                        $("#projectId").append("<option value='0'>全部门</option>");
                        for(let i=0;i<data.list.length;i++){
                            console.log(data.list[i])
                            $("#projectId").append("<option value='"+data.list[i].projectId+"'>"+data.list[i].projectName+"</option>");
                        }

                    }
                }})
        }else {
            $("#projectId").empty();
            $("#projectId").append("<option value='0'>全部门</option>");
        }

    });
    $("#hospitalId").change(function (){
        let v=$(this).val();
        let t= $(this).find("option:selected").text();
        console.log(v,t)
        if(v>0){
            $("#hospitalName").val(t);
        }
        $.ajax({url:'../doctor/departmentList',data:"hospitalId="+v,success:function (data){
                if(data.res){
                    $("#dpId").empty();
                    $("#dpId").append("<option value=''>请选择科室</option>");
                    for(let i=0;i<data.list.length;i++){
                        console.log(data.list[i])
                        $("#dpId").append("<option value='"+data.list[i].id+"'>"+data.list[i].departmentName+"</option>");
                    }

                }
            }})
    });
    $("#serch").click(function() {
        $("#search-form2").submit();
    });
    $().ready(function() {
        $("#add").click(function() {
            location.href = 'add';
        });

        $(".del").click(function() {
            if (confirm('确定删除内容吗？')) {
                let id = $(this).data('id');
                $.ajax({
                    url : 'l_del?id=' + id,
                    success : function(e) {
                        if (e.res) {
                            $("#tr_" + id).remove();
                            layer.msg('删除成功', {icon: 1})
                        }
                    },error:function(e){
                        layer.msg(e.responseText, {icon: 5});
                    }
                });
            }

        });
    });
</script>
</body>
</html>
